package com.sxhuayuan.parking.entity;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sxhuayuan.parking.config.PayStatus;

/**
 * 第三方接口返回的原始停车记录信息<br>
 * uniqueConstraints = { @UniqueConstraint(columnNames = { "entertime",
 * "calcstarttime", "card_no" }) }<br>
 * 由于车场返回数据有误，缴费费后未离场的车再次查询订单时的计费时间还是入场时间（正确的应该是上次缴费时间），所以索引暂改为车场返回的唯一订单号lotOrderNo
 */
@Entity
@Table(name = "hypk_original_parking_info")
public class OriginalParkingInfo extends BaseEntity {

	private static final long serialVersionUID = -7464805294710634864L;
	/** 停车卡卡号 */
	private String cardNo;
	/** 车牌号 */
	private String carNo;
	/** 进场时间 yyyy-MM-dd HH:mm:ss */
	private String entertime;
	/** 停车位置 */
	private String parkposi;
	/** 停车时长,单位分钟 */
	private Long parktime;
	/** 停车费用（应收金额） */
	private BigDecimal parkcost;
	/** 实收金额（单位元，两位小数） */
	private BigDecimal amount;
	/** 计费开始时间 如果入场后还未缴费，时间与进场时间一致；如果之前缴过费但未出场，此时间为上次缴费的时间。 */
	private String calcstarttime;
	/** 计费结束时间 */
	private String calcendtime;
	/** 计费规则详情 */
	private String priceRule;
	/** 计费用详情 */
	private String feeDetail;
	/** 订单编号。如果停车费用为0就不会生成订单。生成的订单如果在15分钟（可配置）之内未缴费，将会被系统自动取消。 */
	private String lotOrderNo;
	/** 场内车序号 */
	private String cardInId;
	/** 收费序列号 */
	private String chargeSeqNo;
	/** 凭证类型 */
	private String credentialtype;
	/** 总折扣 金额 */
	private BigDecimal totalDiscount;
	/** json格式折扣明细（单位元，两位小数） */
	private String discountDetail;

	/** --------- 本平台参数 --------- */
	/** 支付状态 */
	private PayStatus payStatus;
	/** 停车场的编号 */
	private ParkingLot parkingLot;

	/** 停车场名字 */
	private String parkingLotName;

	@Column(length = 32, name = "card_no")
	public String getCardNo() {
		return cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}

	// yyyy-MM-dd HH:mm:ss
	@Column(length = 32)
	public String getEntertime() {
		return entertime;
	}

	public void setEntertime(String entertime) {
		this.entertime = entertime;
	}

	public String getParkposi() {
		return parkposi;
	}

	public void setParkposi(String parkposi) {
		this.parkposi = parkposi;
	}

	public Long getParktime() {
		return parktime;
	}

	public void setParktime(Long parktime) {
		this.parktime = parktime;
	}

	@Column(precision = 10, scale = 2)
	public BigDecimal getParkcost() {
		return parkcost;
	}

	public void setParkcost(BigDecimal parkcost) {
		this.parkcost = parkcost;
	}

	@Column(precision = 10, scale = 2)
	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	@Column(length = 32)
	public String getCalcstarttime() {
		return calcstarttime;
	}

	public void setCalcstarttime(String calcstarttime) {
		this.calcstarttime = calcstarttime;
	}

	@Column(length = 32)
	public String getCalcendtime() {
		return calcendtime;
	}

	public void setCalcendtime(String calcendtime) {
		this.calcendtime = calcendtime;
	}

	public String getFeeDetail() {
		return feeDetail;
	}

	public void setFeeDetail(String feeDetail) {
		this.feeDetail = feeDetail;
	}

	@Column(length = 64, unique = true, nullable = false, updatable = false)
	public String getLotOrderNo() {
		return lotOrderNo;
	}

	public void setLotOrderNo(String lotOrderNo) {
		this.lotOrderNo = lotOrderNo;
	}

	@Column(length = 32)
	public String getCardInId() {
		return cardInId;
	}

	public void setCardInId(String cardInId) {
		this.cardInId = cardInId;
	}

	@Column(length = 64)
	public String getChargeSeqNo() {
		return chargeSeqNo;
	}

	public void setChargeSeqNo(String chargeSeqNo) {
		this.chargeSeqNo = chargeSeqNo;
	}

	@Column(length = 8)
	public String getCredentialtype() {
		return credentialtype;
	}

	public void setCredentialtype(String credentialtype) {
		this.credentialtype = credentialtype;
	}

	@Column(precision = 10, scale = 2)
	public BigDecimal getTotalDiscount() {
		return totalDiscount;
	}

	public void setTotalDiscount(BigDecimal totalDiscount) {
		this.totalDiscount = totalDiscount;
	}

	public String getPriceRule() {
		return priceRule;
	}

	public void setPriceRule(String priceRule) {
		this.priceRule = priceRule;
	}

	@Column(length = 16)
	public String getCarNo() {
		return carNo;
	}

	public void setCarNo(String carNo) {
		this.carNo = carNo;
	}

	@Column(length = 1024)
	public String getDiscountDetail() {
		return discountDetail;
	}

	public void setDiscountDetail(String discountDetail) {
		this.discountDetail = discountDetail;
	}

	// public Platform getPlatform() {
	// return platform;
	// }
	//
	// public void setPlatform(Platform platform) {
	// this.platform = platform;
	// }

	public PayStatus getPayStatus() {
		return payStatus;
	}

	public void setPayStatus(PayStatus payStatus) {
		this.payStatus = payStatus;
	}

	// public Boolean getIsRiseSuccess() {
	// return isRiseSuccess;
	// }
	//
	// public void setIsRiseSuccess(Boolean isRiseSuccess) {
	// this.isRiseSuccess = isRiseSuccess;
	// }

	@Column(length = 32)
	public String getParkingLotName() {
		return parkingLotName;
	}

	public void setParkingLotName(String parkingLotName) {
		this.parkingLotName = parkingLotName;
	}

	@JsonIgnore
	@ManyToOne(fetch = FetchType.LAZY)
	public ParkingLot getParkingLot() {
		return parkingLot;
	}

	public void setParkingLot(ParkingLot parkingLot) {
		this.parkingLot = parkingLot;
	}

}
